﻿<%
'定义模型设置相关的变量
Dim ChannelID, ChannelName, ChannelPicUrl, ChannelRemark, ChannelColor, ChannelBold, ChannelOpenType, ChannelHidden, ChannelType
Dim ChannelOrder, ChannelModuleType, ChannelDir, ChannelTit, ChannelDataName, ChannelUnit, ChannelListNum, ChannelShowName, ChannelSetup
Dim ChannelClassDepth, ChannelPosition, ChannelPut, ChannelUploadType, ChannelMaxFileSize, ChannelPicWidth, ChannelPicHeight, ChannelUpFileType
Dim ChannelCuteNum, ChannelLeftCuteNum, ChannelCount, ChannelHits, ChannelOption, ChannelUploadDir, ChannelReward, ChannelDates, ChannelRssField
Dim ChannelPower, ChannelPHidden, ChannelIsCreateHtml, ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlPath, ChannelHtmlForm, ChannelMoban
Dim ChannelSkinID, ChannelTemplateID, iUpFileType, ChannelUrl, ChannelIsCreatHtml
Dim ReviewTrue, SpecialTrue, RemoteTrue, FristTrue, CastTrue, KeyWordTrue, ErrTrue, IsHealth

'//* 模型信息处理 *//
'--- 模型初始化操作
Public Function GetChannel(ByVal nChannelID)
	Dim sqlChannel, rsChannel
	If nChannelID > 0 Then
		sqlChannel = "select * from Channel where ChannelID=" & nChannelID
		Call Exec(rsChannel,sqlChannel,2)
		If rsChannel.BOF And rsChannel.EOF Then
			Format_Redirect(InstallDir & "Include/Error.asp?Action=Error&Text="&Server.UrlEncode("找不到指定的模型！"))
		Else
			If rsChannel("ChannelHidden") = True Then
				Format_Redirect(InstallDir & "Include/Error.asp?Action=Error&Text="&Server.UrlEncode("此模型已经被管理员禁用！"))
			Else
				ChannelName			 = Code_Html(rsChannel("ChannelName"),1,0)
				ChannelPicUrl		 = rsChannel("ChannelPicUrl")
				ChannelRemark		 = rsChannel("ChannelRemark")
				ChannelColor		 = rsChannel("ChannelColor")
				ChannelBold			 = rsChannel("ChannelBold")
				ChannelOpenType		 = rsChannel("ChannelOpenType")
				ChannelHidden		 = rsChannel("ChannelHidden")
				ChannelType			 = rsChannel("ChannelType")
				'只使用绝对地址时，才使用模型子域名
				If IsNull(rsChannel("LinkUrl")) Or Trim(rsChannel("LinkUrl")) = "" Or Left(InstallDir, 7) <> "http://" Then
					ChannelUrl = InstallDir & ChannelDir
				Else
					ChannelUrl = rsChannel("LinkUrl")
				End If
				If Right(ChannelUrl, 1) = "/" Then
					ChannelUrl = Left(ChannelUrl, Len(ChannelUrl) - 1)
				End If
				ChannelOrder		 = rsChannel("ChannelOrder")
				ChannelModuleType	 = rsChannel("ModuleType")
				ChannelDir			 = Replace(Replace(rsChannel("ChannelDir"),"/",""),"\","")
				ChannelTit			 = Code_Html(rsChannel("ChannelTit"),1,0)
				ChannelDataName		 = rsChannel("ChannelDataName")
				ChannelUnit			 = Code_Html(rsChannel("ChannelUnit"),1,0)
				ChannelListNum		 = Split(rsChannel("ChannelListNum"),"@@@")
				ChannelShowName		 = rsChannel("ShowName")
				ChannelSetup		 = Cstr(rsChannel("ChannelSetup"))
				ChannelClassDepth	 = rsChannel("ClassDepth")
				ChannelPosition		 = Split(rsChannel("ChannelPosition"),"@@@")
				ChannelPut			 = Int(rsChannel("ChannelPut"))
				ChannelUploadType	 = Int(rsChannel("UploadType"))
				ChannelMaxFileSize	 = Int(rsChannel("MaxFileSize"))
				ChannelPicWidth		 = Int(rsChannel("PicWidth"))
				ChannelPicHeight	 = Int(rsChannel("PicHeight"))
				ChannelUpFileType	 = Cstr(rsChannel("UpFileType"))
				ChannelCuteNum		 = Split(rsChannel("CuteNum"),"@@@")
				ChannelLeftCuteNum	 = Int(rsChannel("LeftCuteNum"))
				ChannelCount		 = rsChannel("ChannelCount")
				ChannelHits			 = rsChannel("ChannelHits")
				ChannelOption		 = rsChannel("ChannelOption")
				ChannelUploadDir	 = rsChannel("UploadDir")
				ChannelReward		 = Split(rsChannel("ChannelReward"),"@@@")
				ChannelDates		 = Split(rsChannel("ChannelDates"),"@@@")
				ChannelRssField		 = rsChannel("RssField")
				ChannelPower		 = rsChannel("ChannelPower")
				ChannelPHidden		 = rsChannel("ChannelPHidden")
				ChannelIsCreateHtml	 = rsChannel("IsCreateHtml")
				ChannelHtmlExtName	 = rsChannel("HtmlExtName")
				ChannelHtmlPrefix	 = rsChannel("HtmlPrefix")
				ChannelHtmlPath		 = rsChannel("HtmlPath")
				ChannelHtmlForm		 = rsChannel("HtmlForm")
				ChannelMoban		 = rsChannel("Moban")
				ChannelSkinID		 = rsChannel("SkinID")
				ChannelTemplateID	 = rsChannel("TemplateID")
			End If
		rsChannel.Close
		Set rsChannel = Nothing
		End If
	End If
	If ChannelClassDepth = 0 Then ChannelClassDepth = 99999999
	iUpFileType = Split(ChannelUpFileType,"@@@")
	If Not IsArray(iUpFileType) Then
		ChannelUpFileType = Split("@@@@@@@@@@@@","@@@")
	Else
		ChannelUpFileType = iUpFileType
		Erase iUpFileType
	End If
	If Get_ChannelSetup(ChannelSetup,2) = 1 Then ReviewTrue = True
	If Get_ChannelSetup(ChannelSetup,3) = 1 Then SpecialTrue = True
	If Get_ChannelSetup(ChannelSetup,12) = 1 Then RemoteTrue = True
	If Get_ChannelSetup(ChannelSetup,17) = 1 Then FristTrue = True
	If Get_ChannelSetup(ChannelSetup,13) = 1 Then CastTrue = True
	If Get_ChannelSetup(ChannelSetup,4) = 1 Then KeyWordTrue = True
	If Get_ChannelSetup(ChannelSetup,5) = 1 Then ErrTrue = True
	If Get_ChannelSetup(ChannelSetup,8) = 1 Then IsHealth = True
End Function
%>